package com.zlx.listener;

import com.zlx.test.MyTask;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import java.util.Date;
import java.util.Timer;

/**
 * @author admin
 * @date 2020/9/25
 * @Description
 */
@WebListener
public class ApplicationListener implements ServletContextListener {
    /**
     * @Author 周罗校
     * @Description 使用进行修改时间的状态
     * @Param
     * @return
     * @Date 2020.09.26 10:00:23
     **/
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        Timer timer = new Timer();
        MyTask myTask = new MyTask();
        //一分钟 1000*60
        timer.schedule(myTask, new Date(), 1000*60);
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {

    }
}
